package cn.explink.dop.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @author songkaojun
 */
public enum OrderPayMethodEnum {

	WEB_PAYMENT(1, "网上支付"), CASH_PAYMENT(2, "现金支付"), POS_PAYMENT(3, "POS机支付");

	private int value;

	private String text;

	private OrderPayMethodEnum(int value, String text) {
		this.value = value;
		this.text = text;
	}

	public int getValue() {
		return this.value;
	}

	public String getText() {
		return this.text;
	}

	public static List<OrderPayMethodEnum> getAllStatus() {
		List<OrderPayMethodEnum> payMethodEnumList = new ArrayList<OrderPayMethodEnum>();
		payMethodEnumList.add(WEB_PAYMENT);
		payMethodEnumList.add(CASH_PAYMENT);
		payMethodEnumList.add(POS_PAYMENT);
		return payMethodEnumList;
	}

	public static String getTextByValue(int value) {
		List<OrderPayMethodEnum> allStatus = OrderPayMethodEnum.getAllStatus();
		for (OrderPayMethodEnum orderPayMethodEnum : allStatus) {
			if (orderPayMethodEnum.getValue() == value) {
				return orderPayMethodEnum.getText();
			}
		}
		return "";
	}
}
